/*
 * @Author: yanfeixin
 * @Date: 2025-04-05 10:45:19
 * @LastEditTime: 2025-04-21 17:30:32
 * @LastEditors: yanfeixin
 * @Description:
 */
import type { App } from 'vue'
import type { RouteRecordRaw } from 'vue-router'

import {
  createRouter,
  createWebHashHistory,
} from 'vue-router'
import { createRouterGuard } from './guard'

const routes: RouteRecordRaw [] = [
  {
    path: '/login',
    component: () => import('@/views/Login/Login.vue'),
    name: 'Login',
  },
  {
    path: '/404',
    component: () => import('@/views/Error/404.vue'),
    name: 'NoFind404',
  },
  {
    path: '/403',
    component: () => import('@/views/Error/403.vue'),
    name: '403',
  },
]
export const router = createRouter({
  history: createWebHashHistory('/'),
  routes,
  scrollBehavior: () => ({ left: 0, top: 0 }),
})
export async function setupRouter(app: App) {
  app.use(router)
  createRouterGuard(router)
  await router.isReady()
}
